# using Visual Studio C/C++
set(CMAKE_C_FLAGS_MINSIZEREL " /Ob2 /DNDEBUG /W3 /MT /c /std:c11 -D_CRT_SECURE_NO_WARNINGS")
set(CMAKE_C_FLAGS_DEBUG "/Zi /Ob0 /Od /W3 /MDd /c /std:c11 -D_CRT_SECURE_NO_WARNINGS")
set(CMAKE_CXX_FLAGS_MINSIZEREL " /Ob2 /DNDEBUG /W3 /MT -D_CRT_SECURE_NO_WARNINGS")
set(CMAKE_CXX_FLAGS_DEBUG "/Zi /Ob0 /Od /W3 /MDd -D_CRT_SECURE_NO_WARNINGS")

add_definitions(-D_CRT_SECURE_NO_WARNINGS)

set(EXTRA_COMPILER_DEFINITIONS ${EXTRA_COMPILER_DEFINITIONS} "/D _CRT_SECURE_NO_WARNINGS")
set(EXTRA_COMPILER_DEFINITIONS ${EXTRA_COMPILER_DEFINITIONS} "/D WIN32_LEAN_AND_MEAN")

if(USE_SANITIZERS)
    set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /RTCu")
    set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /RTCu")

    set(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "${CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL} /RTCu")
    set(CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL "${CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL} /RTCu")
endif()

# set the runtime library for linking
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
